	var $=KISSY.all;
	var TIMEOUT_DIALOG = 2000;
	var CLS_SNOWER = "snower";
	var wheels; 
	if(KISSY.UA.shell=="ie"){
		$(".action_flash_wheel").removeClass("hide");
		$(".action_egg").css("background","#FFF");
		$(".wheels_ac").css("background-image","none");
		$(".action_egg").css("-moz-opacity",0);
		$(".action_egg").css("opacity",0);
		$(".action_egg").css("filter","alpha(opacity=0)");
	}else{
		wheel(10000,100);
	}

	/*
	 * dialog 兼容
	 * container.find 改为 container.all
	 * .off("click")改为 .detach("click")
	 */
	var dialog = new Dialog(".J_Dialog","","");

	// 锦囊跳动
	var jn_timer = 0;
	var jn_width = $(".jn_bag").width();
	setInterval(function(){
		if(jn_timer>50){
			jn_timer = 0;
		}
		if(jn_timer<10){
			var re = (jn_width+Math.sin(jn_timer)*3);
			$(".jn_bag").css("width",re+"px");
			$(".jn_bag").css("height",re+"px");
		}
		jn_timer++;
	},100);
	// 锦囊菜单
	$(".poupClose").on("click",function(){
		$(".poupFadIn").hide();
	});
	$(".poupTitleMune").on("click",function(){
		var id = $(this).attr("id");
		$(".poupMain").hide();
		switch(id){
			case "actionExpBtn":
				$(".slideBarTip").css({"left":".6rem"});
				$(".ruleBox").show();
			break;
			case "ranBtn":
				$(".slideBarTip").css({"left":"5rem"});
				$(".rankBox").show();
			break;
			case "prizeBtn":
				$(".slideBarTip").css({"left":"9.6rem"});
				$(".awardBox").show();
			break;
		}
	});
	$(".gg,.gz,.dj").on("click",function(){
		var tp = $(this).attr("data-tp");
		var sid = $(".sid").val();
		switch(tp){
			case "gg" : var t = "活动公告";break;
			case "gz" : var t = "游戏规则";break;
			case "dj" : var t = "兑奖方式";break;
		}
		KISSY.io({
			url: APP.urls.base_url+"&a=getgg&eid="+event_id+"&sid="+sid,
			data:{"tp":tp,"sid":APP.sid},
			success: function(data, textStatus) {
				data.title=t;
				dialog.renderUI(Dialog.TYPE.showMsg, data);
			},
			error: function(){
				alert('出错啦！请仔细检查一下输入的数据是否有误！');
			},
			dataType:"jsonp"
		});
	});
	$('.mission').on("click", function () {
		_handleMission($(this));
	});
	function dolott(){
		dialog.refresh();
		KISSY.io(
		{"url":APP.urls.win+"&eid="+APP.eid,
			"data":false,
			"success":function (data) {
				data = data || {};
				if(APP.chance>0){APP.chance --;}
				$(".J_Times").text(APP.chance);
				switch (data.success) {
					case "mission": //需要完成收藏等任务
						dialog.renderUI(Dialog.TYPE.showPcMission, {"title":data.giftname,"mission":data.mission});
					break;
					case 1: // 中奖
					//中奖后应在$('.win-table')增加一个奖品，并绑定动作
						doanim(data); //播放动画并展示结果
						// setTimeout(function() {
							// dialog.renderUI(Dialog.TYPE.take, data);
						// }, TIMEOUT_DIALOG);
						var tmp="";
						tmp+="<li><ol>"+data.giftname+"</ol>";
						tmp+="<ol style=\"height:110px\"><img src=\""+data.giftpic+"_110x110.jpg\"></ol>";
						tmp+="<p>"+data.giftname+"</p>"; //应是领取方式，暂以名称代替
						var params="";
						if(data.cardno){
							params+=" data-cardno=\""+data.cardno+"\"";
						}
						if(data.secret){
							params+=" data-secret=\""+data.secret+"\"";
						}
						params+=" value=\"领取"+data.gtype_name+"\"";
						params+=" data-mygid=\""+data.mygid+"\"";
						params+=" data-gid=\""+data.gid+"\"";
						params+=" data-gtype=\""+data.gtype_code+"\"";
						params+=" data-getway=\""+data.getway+"\"";
						tmp+="<input type=\"button\" class=\"btn btn-mini btn-info js-giftdh js-myg"+data.mygid+"\" "+params +" /></li>";
						// alert(tmp);
						tmp+=$(".win-table").html();
						$(".win-table").html(tmp);
						$(".js-giftdh").detach("click").on("click", function () {
							_handleWinTable($(this));
						});
						// _self.pass.play(true);
						// egg.toggleClass(CLS_LUCK);
						_fallCoin();
						break;
					case 2: // 未中奖
						data.callback = function () {
							// egg.removeClass(CLS_ON);
						};
						// _self.pass.play(false);
						setTimeout(function() {
							dialog.renderUI(Dialog.TYPE.again, data);
							// 重置参与次数
							// _self._resetCount(data.remainCount);
							// _self.pass.reset();
						}, TIMEOUT_DIALOG);
						break;
					case 3: // 天次数用完
						// egg.removeClass(CLS_ON);
						// _self.hit.removeClass(CLS_ON);
						// _self.pass.play(false);
						setTimeout(function() {
							dialog.renderUI(Dialog.TYPE.noDayTimes, data);
							// 重置参与次数
							_self.pass.reset();
							_self._resetCount(data.remainCount);

						}, TIMEOUT_DIALOG);
						break;
					case 4: // 总次数用完
						// egg.removeClass(CLS_ON);
						// _self.hit.removeClass(CLS_ON);
						// _self.pass.play(false);
						setTimeout(function() {
							dialog.renderUI(Dialog.TYPE.noAllTimes, data);
							// 重置参与次数
							_self.pass.reset();
							_self._resetCount(data.remainCount);
						}, TIMEOUT_DIALOG);
						break;
					default: // 异常提示
						// egg.removeClass(CLS_ON);
						// _self.hit.removeClass(CLS_ON);
						// _self.pass.play(false);
						setTimeout(function() {
							dialog.renderUI(Dialog.TYPE.noDayTimes, {title: data.error});
						}, TIMEOUT_DIALOG);
				}
			},
			
			complete: function(data){
				
			},
			error: function(){
				alert('出错啦！请仔细检查一下输入的数据是否有误！');
			},
			dataType:"jsonp"
		});
	}
	function _fallCoin() 
	{
            var snowsDom = $('.' + CLS_SNOWER),
                img = APP.imgs.coin,
                num = Math.random() * 8 + 7 | 0,
                snows = Array(num).join(",").split(","),
                snowsHTML = "";

            if (!snowsDom.length) {
                snowsHTML = Util.template(TPL_COIN, snows, function () {
                    return {
                        top: "-30px",
                        left: Math.random() * 100 + "%",
                        t1: Math.random() * (8 - 3) + 2 + "s",
                        t2: Math.random() * 2 + "s",
                        t5: Math.random() * (8 - 3) + 2 + "s",
                        url: img,
                        width: Math.round(Math.random() * (38 - 10) + 10) + "px",
                        maxHeight: "43px"
                    };
                });
                snowsDom = $('<div class="' + CLS_SNOWER + '">' + snowsHTML + '</div>');
                $(document.body).append(snowsDom);
            } else {
                snowsDom.show();
            }
    }
	function _handleWinTable(btn) 
	{
		var btn = $(btn),
			getway = btn.attr("data-getway"),
			gtype = btn.attr("data-gtype"),
			mygid = btn.attr("data-mygid"),
			gid = btn.attr("data-gid"),
			cardno = btn.attr("data-cardno"),
			secret = btn.attr("data-secret"),
			url;
		var options = {"getway": getway, "mygid": mygid, "gid": gid,"cardno":cardno,"secret":secret};
			dialog.renderUiSwitch(options);
    }
			//处理领取任务
	function _handleMission(btn)
		{
            var btn = $(btn),
				mis = btn.attr("data-mis"),
				options = {"mis":mis,"eid":APP.eid};
				switch(mis){
					case "everyday" :
						KISSY.io({"url":APP.urls.mission,"data":options,"success":function(json){
							dialog.renderUI(Dialog.TYPE.showMsg, {"title":"每天领取机会","msg":json.msg});
						},dataType:"jsonp"});
					break;
					case "sign" :
						var day = new Date();
					    options.curdate = day.getFullYear()+"-"+(day.getMonth()+1)+"-"+day.getDate();
						KISSY.io({"url":APP.urls.mission,"data":options,"success":function(json){
							if(json.hasError){
								dialog.renderUI(Dialog.TYPE.showMsg, {"title":"抱歉，不能进行签到！","msg":json.msg});
								return;
							}
							$(".poupFadIn").hide();
							options.signList = json.setting;
							dialog.renderUI(Dialog.TYPE.signDays, options);
						},dataType:"jsonp"});
					break;
					case "order" :
						$(".poupFadIn").hide();
						dialog.renderUI(Dialog.TYPE.orderChance, options);
					break;
					case "jifen" :
						KISSY.io({"url":APP.urls.mission,"data":options,"success":function(json){
							if(json.setting.onoff_jfdh==1){
								$(".poupFadIn").hide();
								options.setting = json.setting;
								dialog.renderUI(Dialog.TYPE.jifenChance, options);
							}else{
								dialog.renderUI(Dialog.TYPE.showMsg, {"title":"积分兑换机会","msg":"抱歉！积分兑换功能已关闭。"});
								//alert("抱歉！积分兑换功能已关闭。");
							}
						},dataType:"jsonp"});
					break;
					case "cartadd" :
						KISSY.io({"url":APP.urls.mission,"data":options,"success":function(json){
							$(".poupFadIn").hide();
							dialog.renderUI(Dialog.TYPE.addCartChance, {"cart_items":json.setting,"cart_cfg":json.cart_cfg,"eid":APP.eid});
						},dataType:"jsonp"});
					break;
				}
		}
	function _actionSwitch(action)
	{
		switch(action)
		{
			case "gft":$(".giftFadIn").show();break;
			case "dolott":dolott();break;
			case "cart":cartadd();break;
			case "qiandao":qiandao();break;
			case "duihuan":duihuan();break;
			case "qdduihuan": qiandaorili(); break;
			case "jfjiacheng": jfjiacheng(); break;
			case "ddhjiafen": ddhjiafen(); break;
			case "jinnang": $(".jinnangFadIn").show(); break;
		}
	}
	function getUserInfo(action){
		if(APP.shop_uid){
			_actionSwitch(action);
			return;
		}
		var options = {
				"c":"index",
				"m":"shopmobile",
				"a":"ajax_get_user_info",
				"usernick":APP.usernick,
				"eid":APP.eid,
				"sid":APP.sid,
				"from":"pc"
			};
		//获取用户信息
		KISSY.io(
			{"url":APP.urls.base_url,
			 "data":options,
			 "success":function(re){
				if(re.hasError){
					alert("读取用户信息出错");
				}else{
					$(".loading").hide();
					APP.shop_uid=re.user_info.shop_uid;
					APP.sys_uid=re.user_info.sys_uid;
					APP.point = parseInt(re.user_info.seeds);
					APP.chance = parseInt(re.user_event_info.score);
					APP.followed=re.user_event_info.collect; //存储是否已关注店铺
					APP.eventUid=re.user_info.id;
					APP.urls.win+="&shop_uid="+APP.shop_uid;
					APP.urls.exchange+="&shop_uid="+APP.shop_uid;
					APP.urls.mission+="&shop_uid="+APP.shop_uid;
					APP.urls.signday+="&shop_uid="+APP.shop_uid;
					APP.urls.signpassday+="&shop_uid="+APP.shop_uid;
					APP.urls.signlingjiang+="&shop_uid="+APP.shop_uid;
					APP.urls.gift+="&shop_uid="+APP.shop_uid;
					APP.urls.user+="&shop_uid="+APP.shop_uid;
					$(".J_Seeds").text(APP.point); //设置积分
					$(".J_Times").text(APP.chance); //设置抽奖次数
					//设置签到日历
					dialog.renderUI(Dialog.TYPE.signDays, {"signList": re.signlist,"curdate":new Date()});
					var html_gifts="";
					var test="";
					var html_medal="";
					var mygifts = re.user_event_info.mygifts;
					if(mygifts){
						for(var gift=0;gift<mygifts.length;gift++){
							var tmp="";
							tmp+="<li><ol>"+mygifts[gift].gift_name+"</ol>";
							tmp+="<ol style=\"height:110px\"><img src=\""+mygifts[gift].gift_pic_url+"_110x110.jpg\"></ol>";
							tmp+="<p>"+mygifts[gift].gift_name+"</p>"; //应是领取方式，暂以名称代替
							var params="";
							for(var prm in mygifts[gift].param){
								params+=prm+"=\""+mygifts[gift].param[prm]+"\" ";
							}
							params+=" data-mygid=\""+mygifts[gift].id+"\"";
							params+=" data-gid=\""+mygifts[gift].giftid+"\"";
							params+=" data-gtype=\""+mygifts[gift].gtype_code+"\"";
							tmp+="<input type=\"button\" class=\"btn btn-mini btn-info js-giftdh js-myg"+mygifts[gift].id+"\" "+params +" /></li>";
							html_gifts=tmp+html_gifts;
						}
					}
					$(".win-table").html(html_gifts);
					$(".js-giftdh").on("click", function () {
						_handleWinTable($(this));
					});
					var medal = re.user_event_info.medal;
					if(medal){
						for(var m=0;m<medal.length;m++){
							var tmp="";
							tmp+='<div class="codeInfoBox">';
							tmp+='<div class="djqImgBox"><img src="'+medal[m].pic_url+'_100x100.jpg"/></div>';
							tmp+='<div class="isEmptyAward ellipsis">奖章：'+medal[m].title+'</div>';
							//<!--div class="codeperiod" style="margin: 0.25rem 0.6rem;"><span>兑奖期限</span>：2016.07.20 至 2016.07.27</div-->
							//tmp+='<div class="goDetailIcon">'+medal[m].get_time+'</div>';
							tmp+='<div class="awardWrap"></div>';
							tmp+='<div class="buttons"><input type="button" value="数量：'+medal[m].medal_num +'个" /></div>';
							tmp+='</div>';
							html_medal = tmp+html_medal;
						}
					}
					// alert(html_gifts);
					// alert(html_medal);
					$(".awardInfo").html(html_medal);
					if(APP.mustFollow && APP.followed==0){
						$(".collect").show();
						return;
					}
					_actionSwitch(action);
				}
			},
			
			complete: function(data){
				
			},
			error: function(){
				alert('出错啦！请仔细检查一下输入的数据是否有误！');
			},
			dataType:"jsonp"
		});
	}
	var clicktp;
	TOP.ui("authbtn", {
		 type:'mini',
		 onload:function(handler){ 
			$(".dolott,.action,.gua,.jinnang,.mygift,.js-cart,.js-qiandao,.js-jfduihuan,.js-ddhjiafen,.js-duihuan,.js-qdduihuan,.js-jfjiacheng").on("click",function(){
				clicktp=$(this).attr("data-tp");
				if(!APP.usernick){
					handler();
				}else{
					getUserInfo(clicktp);
				}
			});
		 },
		 callback: function(data){ 
			if(data.success){
				APP.usernick = (data.result.taobao_user_nick); 
				getUserInfo(clicktp);
			}else{
				dialog.renderUI(Dialog.TYPE.login);
			}
		 }
	});

	// 以下是动画
	$(".dicesdiv").css("-moz-opacity",0);
	$(".dicesdiv").css("opacity",0);
	$(".dicesdiv").css("filter","alpha(opacity=0)");
	function doanim(data){
		var curtool = $(".curtool").val();
		//水果机的动画
		if(curtool=="fruit"){
			dialog.renderUI(Dialog.TYPE.take, data);
			// gameDialog(t,msg,selec,oid,false,top);
		}
		//随机六边形的动画
		if(curtool=="chest"){
			// if(data.score>0){
				$(".chest_ac").hide();
				$(".js-t").remove();
				var gft = getgift(data);
				if(itv){clearInterval(itv);}
				var last_chest;
				var ts=0;
				var itv = setInterval(function (){
					if(last_chest){$(".chest"+last_chest).hide();}
					var i = parseInt(9*Math.random()+1);
					$(".chest"+i).show();
					last_chest=i;
					if(ts>=2000){
					clearInterval(itv);
						if(data.status==true){
							var t = "奖品藏在这";
						}else{
							var t = "天气真好";
						}
						$(".chest_ac ").html("<div class=\"js-t\" style=\"font-size:12px;color:#FF3A3A;margin-top:48px;text-align: center;\">"+gft+"</div>");
						$(".chest_ac ").on("click",function(){
							dialog.renderUI(Dialog.TYPE.take, data);
						// gameDialog(t,msg,selec,oid,false,top);
						});
					}
					ts+=30;
				},30);
			// }else{
				// gameDialog(t,msg,selec,oid);
			// }
		}
		//刮刮卡的动画
		if(curtool=="scratchcards"){
			// if(data.score>0){
			var gft = getgift(data);
			$(".g").remove();
			var g = '<div class="g" style="position:absolute;top: 205px;width:174px;text-align:center;z-index:0">'+gft+'</div>';
			$(g).insertAfter(".gua");
			var b = new KISSY.Anim('.gua',{"width": 0}, 1 ,'',function(){
				dialog.renderUI(Dialog.TYPE.take, data);
				// gameDialog(t,msg,selec,oid,false,top);
				});
			b.run();
		}
		//大富翁的动画
		if(curtool=="dices"){
			var num = $(".fcount").val();
			var giftset=new Array();
			var itv=false;
			for(var i=1;i<=num;i++){
				$(".dd"+i).css("-moz-opacity",0);
				$(".dd"+i).css("opacity",0);
				$(".dd"+i).css("filter","alpha(opacity=0)");
				giftset[i]=$(".dd"+i).attr("data-gft");
			}
			if(itv){clearInterval(itv);}
			// if(data.score>0){
				var row = parseInt(3*Math.random()+1);
				var gift=0;
				if(data.status==false||data.gid==0){
					data.gid=0;
				}
				var s = new Array();
				for(var i=1;i<=giftset.length;i++){
					if(giftset[i]==data.gid){
						s.push(i);
					}
				}
				gift=s[parseInt(s.length*Math.random())];
				var alp = 100;
				var dd = 1;
				var ts = 0;
				var ad = num;
				var rowcont = 0;
				itv = setInterval(function (){
					var ddadd =[0,1,2,3,4];
					if(dd<6){
						for(var i=0;i<ddadd.length;i++){
							$(".dd"+(ad-ddadd[i])).css("-moz-opacity",1-(0.2*(i+1)));
							$(".dd"+(ad-ddadd[i])).css("opacity",1-(0.2*(i+1)));
							$(".dd"+(ad-ddadd[i])).css("filter","alpha(opacity="+100-(20*(i+1))+")");
						}
						ad ++;
					}
					for(var i=0;i<ddadd.length;i++){
						$(".dd"+(dd-ddadd[i])).css("-moz-opacity",1-(0.2*(i+1)));
						$(".dd"+(dd-ddadd[i])).css("opacity",1-(0.2*(i+1)));
						$(".dd"+(dd-ddadd[i])).css("filter","alpha(opacity="+100-(20*(i+1))+")");
					}
					dd++;
					if(dd>num){
						dd=1;
						ad=num;
						rowcont++;
					}
					// $(".gonggao").html(row+"|"+rowcont+"|"+dd+"|"+gift);
					if(dd==gift&&row<=rowcont){
						for(var i=1;i<=num;i++){
							if(i==gift){
								$(".dd"+i).css("-moz-opacity",0.8);
								$(".dd"+i).css("opacity",0.8);
								$(".dd"+i).css("filter","alpha(opacity=80)");
							}else{
								$(".dd"+i).css("-moz-opacity",0);
								$(".dd"+i).css("opacity",0);
								$(".dd"+i).css("filter","alpha(opacity=0)");
							}
						}
						dd=1;
						clearInterval(itv);
						
						dialog.renderUI(Dialog.TYPE.take, data);
						// gameDialog(t,msg,selec,oid,false,top);
					}
					if(rowcont>3){
						dd=1;
						clearInterval(itv);
						
						dialog.renderUI(Dialog.TYPE.take, data);
						// gameDialog(t,msg,selec,oid,false,top);
						for(var i=1;i<=num;i++){
							$(".dd"+i).css("-moz-opacity",0);
							$(".dd"+i).css("opacity",0);
							$(".dd"+i).css("filter","alpha(opacity=0)");
						}
					}
					ts += 30;
				},60);
			// }else{
				// gameDialog(t,msg,selec,oid);
			// }
		}
		//砸金蛋的动画
		if(curtool=="eggs"){
			$(".eggs_ac").css("background-position","-209px 0");
			for(var i=1;i<=12;i++){
				$(".jh"+i).css("visibility","visible");
				var x = parseInt(240*Math.random());
				if(i%2==0){var lft=true;}else{var lft=false;}
				pwx($(".jh"+i).getDOMNode(),x,1,lft);
			}
			setTimeout(function(){
				
				dialog.renderUI(Dialog.TYPE.take, data);
				// gameDialog(t,msg,selec,oid,false,top);
				$(".js-ok,.js-close,.js-dolott").on("click",function(){
					$(".eggs_ac").css("background-position","");
					for(var i=1;i<=12;i++){
						$(".jh"+i).css("left","460px");
						$(".jh"+i).css("top","300px");
						$(".jh"+i).css("visibility","hidden");
					}
				});
			},2000);

		}
		//大转盘的动画
		if(curtool=="wheels"){
			var on = new Array();
			if(data.score==0){
				
				dialog.renderUI(Dialog.TYPE.take, data);
				// gameDialog(t,msg,selec,oid,false,top);
				return;
			}
			if($(".jpbangding").val()==1){
				if(data.status==true){
					var start = $(".gift"+data.gid).attr("data-startdg");
					var end  = $(".gift"+data.gid).attr("data-enddg");
				}else{
					var nonegifts = $(".gift0").getDOMNodes();
					var stopgift = RandomNum(0,nonegifts.length);
					var start = $(nonegifts[stopgift]).attr("data-startdg");
					var end = $(nonegifts[stopgift]).attr("data-enddg");
				}
				var stop = RandomNum(start,end);
					stop += 360*RandomNum(2,4);
					wheel(stop,2,data);
			}else{
				if(data.status==true){
					switch(data.level){
						case "1" :
						on.push(0);
						break;
						case "2" :
						on.push(-90);
						break;
						case "3" :
						on.push(180);
						break;
						case "4" :
						on.push(135);
						break;
						default:
						on.push(45);
						break;
					}
					wheel(on[0]+360*RandomNum(2,4),2,data);
				}else{
					on.push(-45);
					on.push(90);
					on.push(225);
					wheel(on[RandomNum(0,2)]+360*RandomNum(2,4),2,data);
				}
			}
		}
	}
	function pwx(rect,radian,step,lft){
				var animate = function(opt){
					var cos = Math.cos(opt.radian*Math.PI/180);//邻边比斜边,60度的话等于1/2
					var sin = Math.sin(opt.radian*Math.PI/180);//对边比斜边,30度的话等于1/2
					var left = opt.rect.offsetLeft;
					var top = opt.rect.offsetTop;
					if(opt.radian>0){
						if(lft){
							left+=opt.step;
							opt.radian-=1;
							var a = left - opt.initLeft;
							var c = (a/cos);
							var b = (sin*c);
						}else{
							left-=opt.step;
							opt.radian-=1;
							var a = left - opt.initLeft;
							var c = -(a/cos);
							var b = (sin*c);
						}
						opt.rect.style.left = opt.initLeft+a+"px";
						opt.rect.style.top = opt.initTop-b+"px";
						setTimeout(function(){
							animate(opt);
						},10);
					}else{
						opt.rect.style.left = left+opt.step+"px";
						opt.rect.style.top = opt.initTop+"px";
						opt.step && animate({
							step : --opt.step,
							g : 1,
							rect : opt.rect,
							radian : opt.radian,
							initTop : opt.rect.offsetTop,
							initLeft : opt.rect.offsetLeft
						});
					}
				}
				animate({
					step : step,
					g : 1,
					rect : rect,
					radian : radian,
					initTop : rect.offsetTop,
					initLeft : rect.offsetLeft
				});
			}
	function wheel(thdown,fast,data){
		var th=0,fast=fast,tst=thdown;
		if(wheels){clearInterval(wheels);}
		if(!thdown){thdown=360*RandomNum(2,4);}
		if(KISSY.UA.shell=="ie"){
			// IE动画
			$(".action_flash_wheel_flash_gift").addClass("hide");
			$(".action_flash_wheel_flash_slow").addClass("hide");
			$(".action_flash_wheel_flash_quick").removeClass("hide");
		}	
		wheels=setInterval(function (){
			var degree = th/fast;
			th++;
			if(degree && degree+1>=(thdown*Math.PI)/180){
				if(KISSY.UA.shell=="ie"){
					$(".action_flash_wheel_flash_quick").addClass("hide");
					$(".action_flash_wheel_flash_"+(thdown%360)).removeClass("hide");
				}else{
					// 直接定位到指定位置并停止旋转
					wheel_run((thdown*Math.PI)/180);//以matrix旋转
					// run(degree);  //以rotate旋转
				}
				if(data){
					dialog.renderUI(Dialog.TYPE.take, data);
				}
				// gameDialog(t,msg,selec,oid,false,top);
				clearInterval(wheels);
			}else{
				wheel_run(degree);
			}
		},30);
	}

	function wheel_run(degree){
		var a,b,c,d,e,f;
		a = Math.cos(degree).toFixed(6);
		b = Math.sin(degree).toFixed(6);
		c = -(Math.sin(degree)).toFixed(6);
		d = Math.cos(degree).toFixed(6);
		e = 0;
		f = 0;
		// $(".wheels_ac").css("-moz-transform","rotate("+degree+"deg)");
		// $(".wheels_ac").css("-webkit-transform","rotate("+degree+"deg)");
		// $(".wheels_ac").css("-o-transform","rotate("+degree+"deg)");
		// $(".wheels_ac").css("-ms-transform","rotate("+degree+"deg)");
		// $(".wheels_ac").css("-moz-transform","matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")");
		// $(".wheels_ac").css("-webkit-transform","matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")");
		// $(".wheels_ac").css("-o-transform","matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")");
		// $(".wheels_ac").css("-ms-transform","matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")");
		$(".wheels_ac").css("transform","matrix("+a+", "+b+", "+c+", "+d+", "+e+", "+f+")");
	}
	
	function getgift(data){
		if(data.status==true){
			var gft = data.level_name;
		}else{
			var gt = ["大奖在即！","再接再厉","大奖不远啦！","亲，加油！","谢谢参与","调整姿势再来一次"];
			var gft =gt[parseInt(5*Math.random())];
		}
		return gft;
	}
	// function getgift(data){
		// if(data.status==true && data.level=="5"){
			// var gft = "中奖";
			// return gft;
		// }
			// switch(data.level){
				// case "1" : var gft = "一等奖"; break;
				// case "2" : var gft = "二等奖"; break;
				// case "3" : var gft = "三等奖"; break;
				// case "4" : var gft = "鼓励奖"; break;
				// default : 
					// var gt = ["大奖在即！","再接再厉","大奖不远啦！","亲，加油！","谢谢参与"];
					// var gft =gt[parseInt(4*Math.random())];
				// break;
			// }
			// return gft;
	// }
	//刮刮卡换一张
	// var cisrun=false;
	// $(".scratchcards_ac").on("click",function(){
		// $(".gua1").css("width","130px");
		// $(".gua").css("width","130px");
		// if(!cisrun){
			// $(".js-card1").css("left","398px");
			// $(".js-card1").css("display","block");
			// $(".js-card2").css("display","block");
			// var e = new KISSY.Anim('.js-card2',{"left": 398}, 1 ,'easeBothStrong',function(){
						// $(".js-card1").css("display","block");
						// $(".js-card2").css("display","none");
						// $(".gua").css("width","130px");
						// cisrun = false;
						// });
			// var d = new KISSY.Anim('.js-card1',{"left": 258}, 1 ,'easeBothStrong',function(){$(".js-card1").css("display","none");});
			// cisrun = true;
			// d.run();
			// e.run();
		// }
	// });
	var isrun;
	$(".scratchcards_ac").on("click",function(){
		$(".gua1").css("width","130px");
		if(!isrun){
			$(".js-card1").css("left","398px");
			$(".js-card1").css("-moz-opacity","1");
			$(".js-card1").css("opacity","1");
			$(".js-card1").css("filter","alpha(opacity=100)");
			$(".js-card1").css("display","display");
			$(".js-card2").css("display","block");
			var e = new KISSY.Anim('.js-card2',{"left": 398,"-moz-opacity":1,"opacity":1,"filter":"alpha(opacity=100)"}, 1 ,'easeBothStrong',function(){
						$(".js-card1").css("left","398px");
						$(".js-card1").css("-moz-opacity","1");
						$(".js-card1").css("opacity","1");
						$(".js-card1").css("filter","alpha(opacity=100)");
						$(".js-card1").css("display","block");
						$(".js-card2").css("left","530px");
						$(".js-card2").css("-moz-opacity","0");
						$(".js-card2").css("opacity","0");
						$(".js-card2").css("filter","alpha(opacity=0)");
						$(".js-card2").css("display","none");
						$(".gua").css("width","130px");
						isrun = false;
						});
			var d = new KISSY.Anim('.js-card1',{"left": 258,"-moz-opacity":0,"opacity":0,"filter":"alpha(opacity=0)"}, 1 ,'easeBothStrong',function(){$(".js-card1").css("display","none");});
			isrun = true;
			d.run();
			e.run();
		}
	});
	// 水果机自动
	/*
	var s = new KISSY.Anim('.js-fruit1',{"top": 0}, 3 ,'',function(){
			$(".js-fruit1").css("top","-82px");
			s.run();
		});
		s.run();
	var s1 = new KISSY.Anim('.js-fruit2',{"top": 0}, 3 ,'',function(){
			$(".js-fruit2").css("top","-82px");
			s1.run();
		});
		s1.run();
	var s2 = new KISSY.Anim('.js-fruit3',{"top": 0}, 3 ,'',function(){
			$(".js-fruit3").css("top","-82px");
			s2.run();
		});
		s2.run();
	*/	
	function RandomNum(Min,Max){
		var Range = Max - Min;
		var Rand = Math.random();   
		var num = (parseInt(Math.round(Rand * Range))+parseInt(Min));
		return num;
	}
var b = new KISSY.Anim('.winlist',{scrollTop: 0}, 5 ,'',function(){t.run();});
var t = new KISSY.Anim('.winlist',{scrollTop: 100}, 5 ,'',function(){b.run();});
t.run();